var ItemMenuItemRender = new Class({
	"Extends":js.underas.controller.ListViewItemRender
	,"initialize":function(p_obj){						
		var htmlTmp = '<h4><span class="glyphicon glyphicon-'+p_obj.icone+'"></span>'+p_obj.label+'</h4>';
		htmlTmp += '<p class="list-group-item-text">FUNCAO:'+p_obj.funcao+'</p>'; 
		//htmlTmp += '<p class="list-group-item-text">TELA:'+p_obj.tela+'</p>';
		htmlTmp += '<p class="list-group-item-text">ICONE:'+p_obj.icone+'</p>'; 
		this.parent('div',htmlTmp);
		this.getEle().addClass("col-xs-12 col-sm-6 col-md-6");
		}
	});



var ItemMenu = new Class({
	"Extends":js.underas.container.ModWindow
	,"itIdItemMenu":null	 
	,"itLabel":null	 
	,"itFuncao":null	 
	,"itTela":null 
	,"itIdMenu":null	 
	,"itIcone":null	 
	,"initialize":function(){
		this.parent("*Itens do menu.");
		this.setRevision("$Revision: 138 $");		
		this.setSize(4);
		this.itIdItemMenu = new js.underas.controller.InputText("");
		this.itIdItemMenu.setColumn("$idItemMenu");
		this.itIdItemMenu.setLabel("cod.");
		this.itIdItemMenu.setEnable(false);	
		this.itIdItemMenu.setSize(4);	

		this.itLabel = new js.underas.controller.InputText("");
		this.itLabel.setColumn("@label");
		this.itLabel.setLabel("label");
		this.itLabel.setSize(8);	

		this.itFuncao = new js.underas.controller.InputText("");
		this.itFuncao.setColumn("#funcao");
		this.itFuncao.setLabel("funcao");
		this.itFuncao.setSize(12);	

		this.itTela = new js.underas.controller.InputText("");
		this.itTela.setColumn("@tela");
		this.itTela.setLabel("tela");
		this.itTela.setSize(12);

		this.itIdMenu = new js.underas.controller.Select("id_menu");
		this.itIdMenu.setColumn("@idMenu");
		this.itIdMenu.setLabel("menu");
		this.itIdMenu.setValueField("idMenu");
		this.itIdMenu.setLabelField("label");
		this.itIdMenu.setSize(4);	

		this.itIcone = new js.underas.controller.InputText("");
		this.itIcone.setColumn("@icone");
		this.itIcone.setLabel("icone");
		this.itIcone.setSize(8);	
		
		this.mainList = new js.underas.controller.ListView("ItemMenu");
		this.mainList.setItemRender("ItemMenuItemRender");
		this.setMainList("mainList");
		this.mainTb = new js.underas.net.ToolBar({"domain":"menu.business.ItemMenuBLL"});

		this.append(this.mainTb);
		this.append(this.itIdItemMenu);	
		this.append(this.itLabel);		
		this.append(this.itTela);
		this.append(this.itFuncao);	
		this.append(this.itIdMenu);	
		this.append(this.itIcone);	
		this.append(this.mainList);

//		this.addAssociation({"mod":"ItemMenu","url":"js/br/net/atasacramental/itemmenu/view/ItemMenu.js","act":"getByidItemMenu","puid":this.getVarModule()});
	}
	,"onStart":function(){
		this.itIdMenu.fromService("menu.business.MenuBLL.get");
		this.mainTb.activate(true);		
	}
	,"getByIdMenu":function(p_idMenu){
		this.itIdMenu.setValue(p_idMenu);
		rm.addRequest({
			"puid":this.getVarModule()
			,"s":"menu.business.ItemMenuBLL.getByIdMenu"
			,"p":p_idMenu
			,"onLoad":function(dta){
				itemmenu.getMainList().setDataProvider(dta.rs);
			}
		}); 
	}
});